# 第一阶段：利用linux 版本的openjdk17 生成一个环境：myimage，其只包含了base 模块
# ,并从host中复制jar到 镜像中
FROM openjdk:17 as builder
WORKDIR /work
RUN jlink --add-modules java.base --output /work/myimage
COPY $PWD/target/list-demo-1.0-SNAPSHOT.jar /work/myimage/

# 第二阶段： 
FROM debian
WORKDIR /work
COPY --from=builder /work/ /work/
CMD [ "./myimage/bin/java","-jar","./myimage/list-demo-1.0-SNAPSHOT.jar" ]